Skip to content

Conversation

@PascalZajac
Copy link
Contributor

@PascalZajac PascalZajac commented Oct 20, 2025

What & Why?

Migrate from ESLint 8 to ESLint 9 with the new flat config format.

BREAKING CHANGE: This package now requires ESLint 9.x

Why ESLint 9?

  • ESLint 8 reaches end-of-life
  • Flat config is simpler and more explicit
  • Better TypeScript integration
  • Improved performance

📖 Review Guide

TL;DR: Focus on configs/*.js and index.js. Skip the snapshots.

🟢 Skip These (~14K lines)

Files Why Skip
*.snap files Auto-generated, format change only
yarn.lock Dependency lockfile

💡 Tip: Add *.snap to GitHub's file filter to hide them:

  1. Click "Files changed" tab
  2. Click the gear icon ⚙️
  3. Add *.snap to "File filter"

🔴 Focus Review Here (~1.3K lines)

Files What Changed
configs/base.js Core rules → flat config format
configs/typescript.js TS rules → flat config format
configs/react.js React rules → flat config format
index.js Entry point, conditional config loading
utils/index.js hasPackage() helper

🟡 Glance At (~300 lines)

Files What Changed
test/*.spec.js Updated for new ESLint API
README.md Usage instructions updated
package.json "type": "module", peer deps

Changes Summary

Config Structure

- module.exports = { extends: ['...'], rules: {...} }
+ export default [{ rules: {...} }, ...]

ES Modules

- const foo = require('foo');
- module.exports = { ... };
+ import foo from 'foo';
+ export default [...];

Entry Point

- module.exports = { extends: [...] }
+ export default (async () => {
+   const configs = [...baseConfig];
+   if (await hasPackage('react')) configs.push(...reactConfig);
+   return configs;
+ })();

Examples

Before (ESLint 8)

// .eslintrc.js
require('@bigcommerce/eslint-config/patch');

module.exports = {
  extends: ['@bigcommerce/eslint-config'],
};

After (ESLint 9)

// eslint.config.js
import eslintConfig from '@bigcommerce/eslint-config';

export default [...(await eslintConfig)];

Testing

@PascalZajac PascalZajac requested a review from Copilot October 20, 2025 21:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the repository to support ESLint 9 with its new flat config format, replacing the legacy ESLint 8 configuration system. The migration includes converting all modules to ES modules ("type": "module"), replacing CommonJS with ES module syntax, and restructuring configuration files to use the flat config format.

Key Changes:

  • Updated ESLint peer dependency from ^8.0.0 to ^9.0.0 across all packages
  • Converted all configuration files from CommonJS to ES modules
  • Restructured ESLint configs to use flat config format instead of the legacy .eslintrc format

Reviewed Changes

Copilot reviewed 33 out of 41 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Updated ESLint to 9.x, added module type, modified test script for ES modules
packages/eslint-plugin/package.json Updated ESLint peer dependency to 9.x and added module type
packages/eslint-config/package.json Updated ESLint peer dependency to 9.x, added module type, replaced patch dependency with @eslint/js and globals
packages/eslint-plugin/index.js Converted to ES modules with flat config format for plugin configuration
packages/eslint-plugin/rules/jsx-short-circuit-conditionals.js Converted to ES modules and removed deprecated config properties
packages/eslint-plugin/tests/jsx-short-circuit-conditionals.spec.js Converted to ES modules with compatibility handling for default exports
packages/eslint-config/index.js Converted to async ES module returning flat config array
packages/eslint-config/configs/*.js Converted all config files to ES modules with flat config format
packages/eslint-config/utils/index.js Converted to async ES module using dynamic imports
packages/eslint-config/test/*.spec.js Updated test files to ES modules with proper async handling
packages/eslint-config/prettier.config.js Converted to ES module export
packages/eslint-config/jest.config.js Added transform config for ES modules
eslint.config.js New flat config file replacing .eslintrc.js
README.md Updated documentation for ESLint 9 migration
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@PascalZajac PascalZajac force-pushed the FE-454 branch 3 times, most recently from 71d0856 to 6940e6a Compare October 22, 2025 23:31
@oliverdowie
Copy link

Any estimate on when this upgrade will be available? I'm currently converting our Catalyst project to Nextjs 16 and ESLint 9 but getting a little stuck on the BigCommerce configs.
Thanks :)

@PascalZajac
Copy link
Contributor Author

@oliverdowie thanks for the question! It actually helps to know there are other people out there interested / waiting on this. We'll aim to get it finalised next week.

BREAKING CHANGE: This package now requires ESLint 9.x

## Summary
- Convert all configs to ESLint 9 flat config format
- Convert from CommonJS to ES modules
- Update peer dependency from eslint@^8.0.0 to eslint@^9.0.0

## Changes by Category

### Config Structure (configs/*.js)
- Restructured all config files to use flat config array format
- Replaced 'extends' with spread operator imports
- Updated plugin references to use new naming convention

### ES Modules Conversion
- Added "type": "module" to package.json files
- Replaced require() with import statements
- Replaced module.exports with export default

### Entry Point (index.js)
- Now exports async config array
- Conditionally includes configs based on installed packages

### Tests
- Updated test utilities for new ESLint API
- Regenerated snapshots with new format

### Dependencies
- Bump lerna ^8.1.2 → ^8.1.8
- Bump typescript ^5.0.2 → ^5.6.3

Addresses Copilot review comments:
- Fix 'Disallows' → 'Disallow' in rule description
- Remove redundant schema comment
- Clarify hasPackage() implementation comment
@icatalina
Copy link
Contributor

hey @danielochoa-epam , can you please rebase instead of merging master into here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants